package com.lanou.myapp.book;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * Created by dllo on 16/1/15.
 */
public class BookFragmentAdapter extends FragmentPagerAdapter{
    private List<Fragment> data;
    private Context context;

    String title1 = "每日一文";
    String title2 = "男生";
    String title3 = "女生";

    String[] titles = {title1,title2,title3};

    public BookFragmentAdapter(FragmentManager fm, List<Fragment> data, Context context) {
        super(fm);
        this.data = data;
        this.context = context;
    }

    @Override
    public Fragment getItem(int position) {
        return data.get(position);
    }

    @Override
    public int getCount() {
        return data.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}
